package com.billdowney.qq.robot.util;//package com.ruoyi.web.controller.Util;
//
//import com.ruoyi.common.core.controller.BaseController;
//import com.ruoyi.common.core.domain.AjaxResult;
////import com.ruoyi.system.domain.ZhiHuiXiTong.ZhiFaXinXiTongJi.Filelvjin;
//
//import org.apache.poi.hssf.usermodel.HSSFRow;
//import org.apache.poi.hssf.usermodel.HSSFSheet;
//import org.apache.poi.hssf.usermodel.HSSFWorkbook;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.PropertySource;
//import org.springframework.stereotype.Component;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import java.io.*;
//import java.util.Iterator;
//@Component
//@PropertySource(value = { "classpath:application.properties" })
//@RequestMapping("/kan")
//public class Test  extends BaseController {
//    @Value("${profile}")
//    private  String profile;
//
//    @GetMapping("/download")
//    public  Object download() throws IOException {
////        long startTime = System.currentTimeMillis(); //获取开始时间
//        String fromPath  =   "D:\\ruoyi\\8月离省信息统计2.xlsx&小紫" +
//                            ",D:\\ruoyi\\8月离省信息统计1.xlsx&小明" +
//                            ",D:\\ruoyi\\xzcxs.xls&小紫" +
//                            ",D:\\ruoyi\\8月离省信息统计.xlsx&小溪";
//        String[] split = fromPath.split(",");
//        String toPath = "D:\\ruoyi\\";//保存新EXCEL路径//新的excel 文件名
//        String excelName = "统计";//创建新的excel
//        HSSFWorkbook wbCreat = new HSSFWorkbook();
////        File file = new File(fromPath);
//        for (String excel : split) {//打开已有的excel
//            String[] split1 = excel.split("&");
//            File file = new File(split1[0]);
////            String strExcelPath = fromPath + "/" + excel.getName();//input 来源 ，output 目的地
//            InputStream in = new FileInputStream(split1[0]);//绝对路径
//            HSSFWorkbook wb = new HSSFWorkbook(in);//获取工作簿的名称，不带前缀
//            String bookName = file.getName().substring(0, file.getName().lastIndexOf("."));//i表示源工作簿 sheet 数量
//            int sheetnum = wb.getNumberOfSheets();
//            for (int i = 0; i < sheetnum; i++) {//开始每个表的处理
//                HSSFSheet sheet = wb.getSheetAt(i);//目标工作簿创建同样的sheet名
////                String sheetName = sheet.getSheetName();
//                int firstRow = sheet.getFirstRowNum();
//                int lastRow = sheet.getLastRowNum();
////                System.out.println("workbook:" + bookName);
////                System.out.println("sheetName:" + sheetName);//如果sheet的lastrow 是0 表示这个表没有内容,这张sheet就不用处理，继续处理下张sheet处理，用continue
//                if (lastRow == 0) {
//                    continue;
//                }
////                HSSFSheet sheetCreat = wbCreat.createSheet(bookName + "_" + sheet.getSheetName());//开始多行的处理
//                HSSFSheet sheetCreat = wbCreat.createSheet(bookName + "_" + split1[1]);//开始多行的处理
//                for (int j = firstRow; j <= lastRow; j++) {//创建新建excel Sheet的行
//                    HSSFRow rowCreat = sheetCreat.createRow(j);//取得源有excel Sheet的行
//                    HSSFRow row = sheet.getRow(j);//单元格式样//如果行的内容为null ，说明行为空行，此行就跳过，继续下行的处理，用continue
//                    if (null == row) {
//                        continue;
//                    }
////                    System.out.println("bookName:" + bookName + "|sheetName:" + sheetName + "|row:" + j);
//                    int lastCell = row.getLastCellNum();
//                    int firstCell = row.getFirstCellNum();
//                    for (int k = firstCell; k < lastCell && lastCell > 0; k++) {
////                        System.out.println(row.getCell(k));
//                        rowCreat.createCell(k);
//                        String strVal = "";
//                        if (row.getCell(k) == null) {
//                        } else {
//                            strVal = row.getCell(k) + "";
//                        }
//                        rowCreat.getCell(k).setCellValue(strVal);
//                    }
////                    System.out.println("单行处理完毕");
//                }
////                System.out.println("多行处理完毕");
//            }
////            System.out.println("多表处理完毕");
//        }
////        System.out.println("多个文件处理完毕");
//        System.out.println(toPath + excelName + ".xls");
//        FileOutputStream fileOut = new FileOutputStream(toPath + excelName + ".xls");
//        wbCreat.write(fileOut);
//        fileOut.close();
//        HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(toPath + excelName + ".xls"));
////        System.out.println(workbook.getNumberOfSheets());
////        long endTime = System.currentTimeMillis(); //获取结束时间
////        System.out.println("程序运行时间：" + (endTime - startTime) + "ms"); //输出程序运行时间
//
//
//        return  AjaxResult.success(toPath + excelName + ".xls");
//    }
//
//
//
//}